import { isJSON, isObjectOrArray } from '/@/utils/is.ts';

export function getAuthCache(key) {
    let v = localStorage.getItem(key);
    if (!isJSON(v)) {
        return v;
    } else {
        return JSON.parse(v);
    }
}

export function setAuthCache(key, value) {
    if (isObjectOrArray(value)) {
        return localStorage.setItem(key, JSON.stringify(value));
    } else {
        return localStorage.setItem(key, value);
    }
}
